import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from "@/views/layout/Layout.vue";
import Login from "@/views/login/Login.vue";
import Home from "@/views/home/Home.vue";

const Product = ()=>import('@/views/product/Product.vue')
const List = ()=>import('@/views/product/list/List.vue')
const Category = ()=>import('@/views/product/category/Category.vue')
const ProductPage = ()=>import('@/views/product/list/ProductPage.vue')
//订单
const Order = () =>import('@/views/order/Order.vue')
const OrderList = () =>import('@/views/order/orderList/OrderList.vue')
const CateList = () =>import('@/views/order/collect/Collect.vue')
// const Contract = () =>import('@/views/order/contract/Contract.vue')

//广告
const Advert = ()=>import('@/views/advert/Advert.vue')
const AdvertList = ()=>import('@/views/advert/advertList/AdvertList.vue')

//系统管理
import SystemManage from '@/views/SystemManage'
import department from '@/views/SystemManage/department'
import role from '@/views/SystemManage/role'
Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    component:Layout,
    meta:{
      title:'首页',
      isLogin:true
    },
    children:[
      {
        path:'/',
        name:'home',
        component:Home,
        meta:{
          title:'首页'
        },
      },
      {
        path:'/product',
        name:'product',
        component:Product,
        // redirect:'/product/list',
        meta:{
          title:'产品管理'
        },
        children:[
          {
            path:'list',
            name:'list',
            component:List,
            meta:{
              title:'产品列表'
            },
          },
          {
            path:'category',
            name:'category',
            component:Category,
            meta:{
              title:'产品分类'
            },
          },
          {
            path:'product-page',
            name:'productpage',
            component:ProductPage,
            meta:{
              activeMenu:'/product/list',
              title:'商品详情'
            }
          }
        ]

      },
      {
        path:'/order',  //订单管理
        name:'order',
        component:Order,
        meta:{
          title:'订单管理'
        },
        children:[
          {
            path:'order-list',
            name:'order-list',
            component:OrderList,
            meta:{
              title:'订单列表'
            },
          },
          {
            path:'collect',
            name:'collect',
            component:CateList,
            meta:{
              title:'订单汇总'
            },
          },
          // {
          //   path:'contract',
          //   name:'contract',
          //   component:Contract,
          //   meta:{
          //     title:'订单合同'
          //   },
          // }
        ]

      },
      {
        path:'/advert',//广告管理
        name:'advert',
        component:Advert,
        meta:{
          title:'广告管理'
        },
        children:[
          {
            path:'advert-list',
            name:'advert-list',
            component:AdvertList,
            meta:{
              title:'广告列表'
            },
          }
         
        ]

      },
      {
        path: "/system",
        name: "system",
        component: SystemManage,
        redirect: "/system/role",
        meta: {
          title: "系统管理",
        },
        children: [
          {
            path: "role",
            name: "role",
            component: role,
            meta: {
              title: "员工管理",
            },
          },
          {
            path: "department",
            name: "department",
            component: department,
            meta: {
              title: "部门管理",
            },
          },
        ],
      },
    ]
  },
  {
    path:'/login',
    name:'login',
    component:Login
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})



export default router
